home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / ScriptX / Documentation / Code Examples from Docs / langguid / chap_06 / xmpl_03.sx < prev    next >
Encoding:
Text File  |  1996-05-21  |  798 b   |  31 lines  |  [TEXT/ttxt]

  1. --<<<
  2. -- Kaleida Labs, Inc.
  3. -- Field Guide to the ScriptX Language
  4. -- chapter 6, example 3
  5.  
  6. --create a module to avoid naming conflicts
  7. module Scratch22 uses ScriptX end
  8. in module Scratch22
  9.  
  10. -- examples of using settings clause of object def expr
  11.  
  12. -- first create the class
  13.  
  14. class Novel () inst vars author, title, characters end
  15.  
  16. -- now create an instance of book
  17. object myNovel (Novel)
  18.     settings
  19.         author:"Emily Bront\<00e9>"
  20.         title:"Wuthering Heights"
  21.         characters:#("Heathcliff","Catherine")
  22. end
  23.  
  24. -- the other way of creating the same object
  25. -- better give it a new name first if you are going to try it here
  26.  
  27. global mySecondNovel := new Novel
  28. mySecondNovel.author := "Emily Bront\<00e9>"
  29. mySecondNovel.title := "Wuthering Heights"
  30. mySecondNovel.characters := #("Heathcliff","Catherine")
  31. -->>>